import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vueDevTools from 'vite-plugin-vue-devtools'
import tailwindcss from "tailwindcss";
import { resolve } from 'path'
export default defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    vueDevTools(),
  ],
  css: {
    postcss: {
      plugins: [tailwindcss],
    },
  },
  server: {
    host: "0.0.0.0",
    open: true,
    port: 7777
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
  assetsInclude: ["**/*.hdr", "**/*.glb"],
  build: {
    outDir: "Vue3_Threejs_Ediator",
    assetsDir: "static",
    emptyOutDir: true,
    minify: "esbuild",
    rollupOptions: {
      input: {
        index: resolve(__dirname, "index.html"),
        preview: resolve(__dirname, "preview.html"),
        modelIframe: resolve(__dirname, "modelIframe.html"),
        vrPage: resolve(__dirname, "vrPage.html")
      },
      output: {
        compact: true,
        entryFileNames: "static/js/[name]-[hash].js",
        chunkFileNames: "static/js/[name]-[hash].js",
        assetFileNames: "static/[ext]/[name].[ext]"
      }
    }
  }
})
